<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title></title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		var arrayObj = new Array();
		$(document).ready(function() {
			$("#officeContent").load(function(){
			var mainheight = $(this).contents().find("body").height()+30;
			$(this).height(mainheight);
			});			
			<c:forEach items="${rylist}" var="drZfryk">
				var id = "${drZfryk.user.id}";		
				var name = "${drZfryk.user.name}";
				var office = "${drZfryk.user.office.name}";
				//var zy = "${fns:getDictLabels(drZfryk.user.zy, 'sys_user_zy', '')}";
				var zy = "${drZfryk.user.keshi.name}";
				//alert(id+"-"+name+"-"+office+"-"+zy);
				dotext(id,name,office,zy);
				//arrayObj.push(id);
			</c:forEach>
			$("#btnExport").click(function(){
				top.$.jBox.confirm("确认要导出用户数据吗？","系统提示",function(v,h,f){
					if(v=="ok"){
						$("#searchForm").attr("action","${ctx}/sys/user/export");
						$("#searchForm").submit();
					}
				},{buttonsFocus:1});
				top.$('.jbox-body .jbox-icon').css('top','55px');
			});
			$("#btnImport").click(function(){
				$.jBox($("#importBox").html(), {title:"导入数据", buttons:{"关闭":true}, 
					bottomText:"导入文件不能超过5M，仅允许导入“xls”或“xlsx”格式文件！"});
			});
		});
		function page(n,s){
			if(n) $("#pageNo").val(n);
			if(s) $("#pageSize").val(s);
			$("#searchForm").attr("action","${ctx}/sys/user/list_zj");
			$("#searchForm").submit();
	    	return false;
	    }
		function dotext(id,name,office,zy){
			var result= $.inArray(id, arrayObj)
			if(result>=0){ 
			}else{ 
				arrayObj.push(id);
				$('.data-result').append("<span class=\"svae_box aui-titlespan\" data-code=\"" + id + "\" data-name=\"" +name+"-"+office+"-"+zy+ "\" onclick=\"removespan_area(this)\">" + name+"-"+office+"-"+zy + "<i>×<\/i><\/span>");
			}
			$('#userids').val(arrayObj.join(","));
			$('#userids_').val(arrayObj.join(","));
		}
		function removespan_area(spanthis) {
			//alert($(spanthis).data("code"));
			$.each(arrayObj,function(index,item){  
				if(item==$(spanthis).data("code")){
					arrayObj.splice(index,1);
				}
			});
			$('a[data-code=' + $(spanthis).data("code") + ']').removeClass('d-item-active');
			if ($('a[data-code=' + $(spanthis).data("code") + ']').length > 0) {
				if ($('a[data-code=' + $(spanthis).data("code") + ']').attr("class").indexOf('data-all') > 0) {
					$('a[data-code=' + $(spanthis).data("code") + ']').parent('li').nextAll('li').find('a').css({ 'color': '#0077b3', 'a.d-item-active:hover': '#fff', 'cursor': 'pointer' });
					$('a[data-code=' + $(spanthis).data("code") + ']').parent('li').nextAll("li").find('a').attr("onclick", "selectProvince(\'sub\',this,\'\')");
		
				}
			}
			$(spanthis).remove();
			$('#userids').val(arrayObj.join(","));
			$('#userids_').val(arrayObj.join(","));
		}	
		function doSubmit(){ 
			$('#inputForm').submit();
		}	
		
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/sys/user/list_zj?sxId=${sxId}">执法人员选择</a></li>
	</ul>
    <sys:message content="${message}"/>	
	<!--<div id="right">-->
    	<iframe id="officeContent" src="${ctx}/sys/user/list_zj_frame" width="100%" frameborder="0"></iframe>
    <!--</div>   --> 
	<form:form id="inputForm" modelAttribute="drZfryk" action="${ctx}/zfryk/drZfryk/save" method="post" class="form-horizontal">
		<form:hidden path="sxId" value="${sxId}"/>
        <form:hidden path="ryFlag" value="00"/>
        <input type="hidden" id="userids" name="userids" value="">
		<sys:message content="${message}"/>		
		<div class="control-group">
			<label class="control-label">已选执法人员：</label>
			<div class="controls">
				<div class="data-result"></div>
			</div>
		</div>  
		<div class="form-actions">
			<input id="btnSubmit" class="btn btn-primary" type="button" value="下一步，配置执法对象库" onClick="javascript:doSubmit();"/>&nbsp;
			<input id="btnCancel" class="btn" type="button" value="返 回" onClick="history.go(-1)"/>
		</div>         
    </form:form>     
</body>
</html>
